<template>
  <div>
    <button v-has="'add'">添加</button>
    <button v-has="'edit'">编辑</button>
    <button v-has="'delete2'">删除</button>
  </div>
</template>

<script>
// import BtnPermission from '../../directive/permission';
export default {
  name: "DirectiveDemo",
  // 局部注册自定义指令
  // directives: {
  //   has: BtnPermission
  // },
  created() {
    const btnPermission = ['add', 'edit', 'delete'];
    localStorage.setItem('btnPermission', JSON.stringify(btnPermission));
  }
};
</script>
